package com.esri.core.internal.tasks.d;

import com.esri.core.geometry.SpatialReference;
import com.esri.core.tasks.na.AttributeParameterValue;
import com.esri.core.tasks.na.DirectionsLengthUnit;
import com.esri.core.tasks.na.DirectionsOutputType;
import com.esri.core.tasks.na.NAFeatures;
import com.esri.core.tasks.na.NAOutputLine;
import com.esri.core.tasks.na.NATimeOfDayUsage;
import com.esri.core.tasks.na.NATravelDirection;
import com.esri.core.tasks.na.UTurnRestriction;
import java.util.ArrayList;
import java.util.Map;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class b extends c {
    private static final long serialVersionUID = 1;
    private NAFeatures r = null;
    private NAFeatures s = null;
    private boolean t = true;
    private String u = null;
    private DirectionsOutputType v = DirectionsOutputType.STANDARD;
    private String w = null;
    private DirectionsLengthUnit x = null;
    private String y = null;
    private boolean z = true;
    private boolean A = false;
    private boolean B = false;
    private Double C = null;
    private Integer D = null;
    private NATravelDirection E = NATravelDirection.SERVER_DEFAULT;
    private Long F = null;
    private NATimeOfDayUsage G = NATimeOfDayUsage.SERVER_DEFAULT;

    public NAFeatures a() {
        return this.r;
    }

    public void a(NAFeatures nAFeatures) {
        this.r = nAFeatures;
    }

    public NAFeatures b() {
        return this.s;
    }

    public void b(NAFeatures nAFeatures) {
        this.s = nAFeatures;
    }

    public boolean c() {
        return this.t;
    }

    public void a(boolean z) {
        this.t = z;
    }

    public String d() {
        return this.u;
    }

    public void a(String str) {
        this.u = str;
    }

    public DirectionsOutputType e() {
        return this.v;
    }

    public void a(DirectionsOutputType directionsOutputType) {
        this.v = directionsOutputType;
    }

    public String f() {
        return this.w;
    }

    public void b(String str) {
        this.w = str;
    }

    public DirectionsLengthUnit g() {
        return this.x;
    }

    public void a(DirectionsLengthUnit directionsLengthUnit) {
        this.x = directionsLengthUnit;
    }

    public String h() {
        return this.y;
    }

    public void c(String str) {
        this.y = str;
    }

    public boolean i() {
        return this.z;
    }

    public void b(boolean z) {
        this.z = z;
    }

    public boolean j() {
        return this.A;
    }

    public void c(boolean z) {
        this.A = z;
    }

    public boolean k() {
        return this.B;
    }

    public void d(boolean z) {
        this.B = z;
    }

    public Double l() {
        return this.C;
    }

    public void a(Double d) {
        this.C = d;
    }

    public Integer m() {
        return this.D;
    }

    public void a(Integer num) {
        this.D = num;
    }

    public NATravelDirection n() {
        return this.E;
    }

    public void a(NATravelDirection nATravelDirection) {
        this.E = nATravelDirection;
    }

    public Long o() {
        return this.F;
    }

    public void a(Long l) {
        this.F = l;
    }

    public NATimeOfDayUsage p() {
        return this.G;
    }

    public void a(NATimeOfDayUsage nATimeOfDayUsage) {
        this.G = nATimeOfDayUsage;
    }

    @Override // com.esri.core.internal.tasks.f
    public Map<String, String> generateRequestParams() throws Exception {
        Map<String, String> H = H();
        NAFeatures nAFeatures = this.r;
        if (nAFeatures != null) {
            H.put("facilities", nAFeatures.toJson());
        }
        NAFeatures nAFeatures2 = this.s;
        if (nAFeatures2 != null) {
            H.put("incidents", nAFeatures2.toJson());
        }
        H.put("returnDirections", Boolean.toString(this.t));
        String str = this.u;
        if (str != null && str.length() > 0) {
            H.put("directionsLanguage", this.u);
        }
        H.put("directionsOutputType", this.v.toString());
        String str2 = this.w;
        if (str2 != null && str2.length() > 0) {
            H.put("directionsStyleName", this.w);
        }
        DirectionsLengthUnit directionsLengthUnit = this.x;
        if (directionsLengthUnit != null) {
            H.put("directionsLengthUnit", directionsLengthUnit.toString());
        }
        String str3 = this.y;
        if (str3 != null && str3.length() > 0) {
            H.put("directionsTimeAttributeName", this.y);
        }
        H.put("returnCFRoutes", Boolean.toString(this.z));
        H.put("returnFacilities", Boolean.toString(this.A));
        H.put("returnIncidents", Boolean.toString(this.B));
        Double d = this.C;
        if (d != null) {
            H.put("defaultCutoff", d.toString());
        }
        Integer num = this.D;
        if (num != null) {
            H.put("defaultTargetFacilityCount", num.toString());
        }
        if (this.E != NATravelDirection.SERVER_DEFAULT) {
            H.put("travelDirection", this.E.toString());
        }
        Long l = this.F;
        if (l != null) {
            H.put("timeOfDay", l.toString());
        }
        if (this.G != NATimeOfDayUsage.SERVER_DEFAULT) {
            H.put("timeOfDayUsage", this.G.toString());
        }
        return H;
    }

    public static b a(JsonParser jsonParser) throws Exception {
        if (com.esri.core.internal.util.d.c(jsonParser)) {
            b bVar = new b();
            while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
                String currentName = jsonParser.getCurrentName();
                jsonParser.nextToken();
                if ("impedance".equals(currentName)) {
                    bVar.k = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : jsonParser.getText();
                } else if ("restrictions".equals(currentName)) {
                    bVar.l = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : b(jsonParser);
                } else if ("restrictUTurns".equals(currentName)) {
                    bVar.m = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : UTurnRestriction.get(jsonParser.getText());
                } else if ("accumulateAttributeNames".equals(currentName)) {
                    bVar.j = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : b(jsonParser);
                } else if ("attributeParameterValues".equals(currentName)) {
                    if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) {
                        bVar.d = null;
                    } else {
                        ArrayList arrayList = new ArrayList();
                        if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
                            while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                                arrayList.add(AttributeParameterValue.fromJson(jsonParser));
                            }
                        }
                        bVar.d = arrayList.isEmpty() ? null : (AttributeParameterValue[]) arrayList.toArray(new AttributeParameterValue[arrayList.size()]);
                    }
                } else if ("outputSpatialReference".equals(currentName)) {
                    bVar.h = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : SpatialReference.fromJson(jsonParser);
                } else if ("defaultCutoffValue".equals(currentName)) {
                    bVar.C = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Double.valueOf(jsonParser.getDoubleValue());
                } else if ("facilityCount".equals(currentName)) {
                    bVar.D = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Integer.valueOf(jsonParser.getIntValue());
                } else if ("travelDirection".equals(currentName)) {
                    bVar.E = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : NATravelDirection.get(jsonParser.getText());
                } else if ("useHierarchy".equals(currentName)) {
                    bVar.n = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Boolean.valueOf(jsonParser.getBooleanValue());
                } else if ("outputLineType".equals(currentName)) {
                    bVar.i = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : NAOutputLine.get(jsonParser.getText());
                } else if ("directionsLanguage".equals(currentName)) {
                    bVar.u = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : jsonParser.getText();
                } else if ("directionsLengthUnits".equals(currentName)) {
                    bVar.x = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : DirectionsLengthUnit.get(jsonParser.getText());
                } else if ("directionsTimeAttribute".equals(currentName)) {
                    bVar.y = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : jsonParser.getText();
                } else if ("timeOfDay".equals(currentName)) {
                    bVar.F = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : Long.valueOf(jsonParser.getLongValue());
                } else if ("timeOfDayUsage".equals(currentName)) {
                    bVar.G = jsonParser.getCurrentToken() == JsonToken.VALUE_NULL ? null : NATimeOfDayUsage.get(jsonParser.getText());
                } else {
                    jsonParser.skipChildren();
                }
            }
            return bVar;
        }
        return null;
    }
}
